<template>
  <div class="previewImg" @click="closePreviewImg">
    <img :src="imgUrl" alt="" />
  </div>
</template>

<script>
export default {
  props: {
    imgUrl: {
      type: String,
    },
  },
  data() {
    return {}
  },
  methods: {
    closePreviewImg() {
      this.$parent.showPreviewImg = false
    },
  },
}
</script>

<style>
.previewImg {
  background-color: rgba(0, 0, 0, 0.8);
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 999;
  display: flex;
  justify-content: center;
  align-items: center;
}
.previewImg img {
  width: 80%;
}
</style>
